<?php
/*----------------------------------------------------------------------------------------------
Kit Applicatif PHP
Noyau générique d'applications PHP / generic kernel for PHP applications
noyau 0.4 / PHP 4
http://code.fredbird.org/kap

fonctions de l'API 


file version 2005-06-02 15:11:17
----------------------------------------------------------------------------------------------*/

function kapRunEvent($event,$parameters=NULL) {
	return $GLOBALS['KAP']->runEvent($event,$parameters);
}
function kapQueueEvent($event,$priority,$parameters=NULL) {
	return $GLOBALS['KAP']->queueEvent($event,$priority,$parameters);
}
function kapCancelEvent($event) {
	return $GLOBALS['KAP']->cancelEvent($event);
}
function kapCancelAllEvents() {
	return $GLOBALS['KAP']->cancelAllEvents();
}
//--------------------------------------------------------------------------------------- affichage
function & kapPageSetTemplate($file,$path=NULL) {
	return $GLOBALS['KAP']->pageSetTemplate($file,$path);
}
function & kapPageInsert($content,$path='/body',$id=NULL) {
	return $GLOBALS['KAP']->pageInsert($content,$path,$id);
}
function & kapPageSend() {
	return $GLOBALS['KAP']->pageSend();
}
function & kapPageSetTitle($title) {
	return $GLOBALS['KAP']->pageSetTitle($title);
}
function & kapPageSet($content,$path='/body') {
	return $GLOBALS['KAP']->pageSet($content,$path);
}
function kapTemplateFeed($template,$data=array()) {
	return $GLOBALS['KAP']->templateFeed($template,$data);
}
//--------------------------------------------------------------------------------------- variables
function & kapInitVar($key,$value) {
	return $GLOBALS['KAP']->initVar($key,$value);
}
function & kapSetVar($key,& $value) {
	return $GLOBALS['KAP']->setVar($key,& $value);
}
function & kapDestroyVar($key) {
	return $GLOBALS['KAP']->destroyVar($key);
}
function & kapGetVar($key) {
	//echo affvar($this->components['varmanager']['data'],false);
	return $GLOBALS['KAP']->getVar($key);
}
function & kapGetVarIn($key,$search='tmp_post') {
	return $GLOBALS['KAP']->getVarIn($key,$search);
}
function & kapGetVars($keys) {
	return $GLOBALS['KAP']->getVars($keys);
}
function & kapGetVarsIn($keys,$search="tmp_post") {
	return $GLOBALS['KAP']->getVarsIn($keys,$search);
}
function kapStoreVar($key,$value=NULL) {
	return $GLOBALS['KAP']->storeVar($key,$value);
}
function kapGetAllVars() {
	return $GLOBALS['KAP']->GetAllVars();
}
function kapArrayMergeRR(&$array1, &$array2) {
	return $GLOBALS['KAP']->arrayMergeRR($array1, $array2);
}
function kapVarToXml(&$value,$key="") {
	return $GLOBALS['KAP']->varToXml($value,$key);
}
function kapVarToDeclaration($value,$key=NULL) {
	return $GLOBALS['KAP']->varToDeclaration($value,$key);
}
function kapAffVar($var,$key='',$cut=50) {
	return $GLOBALS['KAP']->affVar($var,$key,$cut);
}
//------------------------------------------------------------------------------------ abstractions
/*function kapXmlAlgorithmLoadMap($xml,$ref=NULL) {
	return $GLOBALS['KAP']->xmlAlgorithmLoadMap($xml,$ref);
}
function kapXmlAlgorithmLoad($xml,$ref=NULL,$data=array(),$maps="") {
	return $GLOBALS['KAP']->xmlAlgorithmLoad($xml,$ref,$data,$maps);
}
function kapXmlAlgorithmExecute($ref,$xpath=NULL,$data=NULL) {
	return $GLOBALS['KAP']->xmlAlgorithmExecute($ref,$xpath,$data);
}

function kapSqlInterfaceLoad($xml,$ref=NULL,$data=NULL) {
	return $GLOBALS['KAP']->sqlInterfaceLoad($xml,$ref,$data);
}
function kapSqlInterfaceRun($action,$ref=NULL,$data=NULL) {
	return $GLOBALS['KAP']->sqlInterfaceRun($action,$ref,$data);
}*/
//--------------------------------------------------------------------------------------------- SQL
function kapSqlOpen($base=NULL) {
	return $GLOBALS['KAP']->sqlOpen($base);
}
function kapSqlSetDb($base) {
	return $GLOBALS['KAP']->SqlSetDb($base);
}
function kapSqlExecute($query) {
	return $GLOBALS['KAP']->sqlExecute($query);
}
function kapSqlSecureValue($value) {
	return $GLOBALS['KAP']->sqlSecureValue($value);
}
function kapSqlResult($query,$indexField=NULL) {
	return $GLOBALS['KAP']->sqlresult($query,$indexField);
}
function kapSqlUniqueResult($query) {
	return $GLOBALS['KAP']->sqlUniqueResult($query);
}
function kapSqlTableStructure($tableName) {
	return $GLOBALS['KAP']->sqlTableStructure($tableName);
}
function kapSqlInsertArray($table,$data=array(),$explicitNegative=false) {
	return $GLOBALS['KAP']->sqlInsertArray($table,$data,$explicitNegative);
}
function kapSqlLastOpSummary($mode='string') {
	return $GLOBALS['KAP']->sqlLastOpSummary($mode);
}
//--------------------------------------------------------------------------- librairies et classes
// inclusions de librairie, transmissions d'instances
function kapNeedLibrary($name) {
	return $GLOBALS['KAP']->needLibrary($name);
}
// retourne une instance la classe, avec passage de zéro à cinq arguments
function & kapNeedObject($class) {
	$lib=& $GLOBALS['KAP']->needComponent('libmanager');
	$param=array_slice(func_get_args(),1);
	return $lib->needObject($class,$param);
}
// idem, pour les librairies du noyau
function & kapNeedCoreObject($class) {
	$lib=& $GLOBALS['KAP']->needComponent('libmanager');
	$param=array_slice(func_get_args(),1);
	return $lib->needCoreObject($class,$param);
}
// renvoie la reference d'une instance unique de la classe
// instancie la classe si nécessaire, avec passage de zéro à cinq arguments
function & kapNeedUniqueObject($name, $class='') {
	$lib=& $GLOBALS['KAP']->needComponent('libmanager');
	$param=array_slice(func_get_args(),2);
	return $lib->needUniqueObject($name,$class,$param);
}
function kapNeedFunction($name) {
	return $GLOBALS['KAP']->needFunction($name);
}
function kapNeedClass($name) {
	return $GLOBALS['KAP']->needClass($name);
}
//---------------------------------------------------------------------------- gestion des fichiers
function kapFileContent($file) {
	return $GLOBALS['KAP']->fileContent($file);
}
function kapFileGetMimeType($file) {
	return $GLOBALS['KAP']->FileGetMimeType($file);
}
function kapFileListPath($path, $recurse=false) {
	return $GLOBALS['KAP']->fileListPath($path, $recurse);
}
function kapFileInfo($file) {
	return $GLOBALS['KAP']->fileInfo($file);
}
function kapFileRegexSearchPathName($regex,$path="",$recurse=false) {
	return $GLOBALS['KAP']->fileRegexSearchPathName($regex,$path,$recurse);
}
function kapFileRegexSearchPathContent($regex,$path="",$recurse=false,$around=25) {
	return $GLOBALS['KAP']->fileRegexSearchPathContent($regex,$path,$recurse,$around);
}
function kapFileRegexSearchContent($regex,$path="",$around=25) {
	return $GLOBALS['KAP']->fileRegexSearchContent($regex,$path,$around);
}
function kapFileSafeUpload($postName,$path,$newName=NULL) {
	return $GLOBALS['KAP']->fileSafeUpload($postName,$path,$newName);
}
function kapFileVersionUpload($postName,$path) {
	return $GLOBALS['KAP']->fileVersionUpload($postName,$path);
}
//--------------------------------------------------------contrôle d'accès, utilisateurs et groupes
function kapAccessCheckUri($uri) {
	return $GLOBALS['KAP']->AccessCheckUri($uri);
}
// retourne l'id de l'utilisateur connecté le cas échéant
function kapAccessAuthenticateUser() {
	return $GLOBALS['KAP']->accessAuthenticateUser();
}
function kapAccessLogOut() {
	return $GLOBALS['KAP']->accesslogOut();
}

function kapUserAdd($data) {
	return $GLOBALS['KAP']->userAdd($data);
}
function kapUserGetById($id) {
	return $GLOBALS['KAP']->UserGetById($id);
}
function kapUserGetIdByLoginPwd($login,$pwd) {
	return $GLOBALS['KAP']->UserGetIdByLoginPwd($login,$pwd);
}
function kapConnexionCheck($key=NULL) {
	return $GLOBALS['KAP']->connexionCheck($key);
}
function kapConnexionOpen($userId) {
	return $GLOBALS['KAP']->connexionOpen($userId);
}
function kapConnexionClose($key) {
	return $GLOBALS['KAP']->connexionClose($key);
}
function kapUriPermissionIsPublic($uri=NULL) {
	return $GLOBALS['KAP']->uriPermissionIsPublic($uri);
}
function kapUriPermissionCheckId($id,$uri=NULL) {
	return $GLOBALS['KAP']->uriPermissionCheckId($id,$uri);
}
function kapUriPermissionCheckIds($ids=array(),$uri=NULL) {
	return $GLOBALS['KAP']->uriPermissionCheckIds($ids,$uri);
}
function kapGroupGetUserGroupIds($user_id) {
	return $GLOBALS['KAP']->groupGetUserGroupIds($user_id);
}
//-------------------------------------------------------------------------------------- navigation
function kapNavLoadArbo($file, $prefixUri=NULL) {
	return $GLOBALS['KAP']->navLoadArbo($file, $prefixUri);
}
function kapNavPathFromRoot($uri=NULL) {
	return $GLOBALS['KAP']->navPathFromRoot($uri);
}
function kapNavTopLevel() {
	return $GLOBALS['KAP']->navTopLevel();
}
function kapNavSameLevel($uri=NULL) {
	return $GLOBALS['KAP']->navSameLevel($uri);
}
function kapNavChildren($uri=NULL) {
	return $GLOBALS['KAP']->navChildren($uri);
}
function kapNavTree() {
	return $GLOBALS['KAP']->navTree();
}
//-------------------------------------------------------------------- autour des dates et du temps
function kapDateConvert($output_format,$date=NULL,$input_format=NULL) {
	return $GLOBALS['KAP']->dateConvert($output_format,$date,$input_format);
}
function kapDateFr($format,$date=NULL,$input_format=NULL) {
	return $GLOBALS['KAP']->dateFr($format,$date,$input_format);
}
function kapDateWeek($date=NULL) {
	return $GLOBALS['KAP']->dateWeek($date);
}
function kapDateYear($date=NULL) {
	return $GLOBALS['KAP']->dateYear($date);
}
function kapDateSelectForm($prefix="",$date=NULL,$elements="mday_mon_year",$label=NULL) {
	return $GLOBALS['KAP']->dateSelectForm($prefix,$date,$elements,$label);
}
function kapDateCatchForm($prefix="",$output_format="php_getdate") {
	return $GLOBALS['KAP']->dateCatchForm($prefix,$output_format);
}
function kapDateAdd($date1,$date2,$outputFormat=NULL) {
	return $GLOBALS['KAP']->dateAdd($date1,$date2,$outputFormat);
}
function kapDateSoustract($date1,$date2,$outputFormat=NULL) {
	return $GLOBALS['KAP']->dateSoustract($date1,$date2,$outputFormat);
}
function kapTimeTaken() {
	return $GLOBALS['KAP']->timeTaken();
}
//----------------------------------------------------------------------- autour du texte et du xml
function kapXmlEntities(& $str) {
	return $GLOBALS['KAP']->xmlEntities($str);
}
function kapXmlEntitiesDecode(& $str) {
	return $GLOBALS['KAP']->xmlEntitiesDecode($str);
}
//----------------------------------------------------------------------------- gestion des erreurs
/*function kapNotice($txt) {
	return $GLOBALS['KAP']->notice($txt);
}
function kapWarning($txt) {
	return $GLOBALS['KAP']->warning($txt);
}
function kapError($txt) {
	return $GLOBALS['KAP']->error($txt);
}*/
function kapLog($msg) {
	return $GLOBALS['KAP']->Log($msg);
}
//------------------------------------------------------------------------------------------ divers
function kapCheckPhpVersion($minimum="4.3.0") {
	return $GLOBALS['KAP']->CheckPhpVersion($minimum="4.3.0");
}
function kapCheckExtension($extension) {
	return $GLOBALS['KAP']->checkExtension($extension);
}
function kapShutDown($showlog="none") {
	return $GLOBALS['KAP']->shutdown($showlog);
}
function kapAlert($txt) {
	return $GLOBALS['KAP']->alert($txt);
}
?>
